ODAC

TCustomDAConnection.ExecSQL Method

Executes a SQL statement with parameters.

Class

TCustomDAConnection

Syntax

function ExecSQL(const Text: string): variant; overload;function ExecSQL(const Text: string; const Params: array of variant): variant; overload; virtual;

Parameters
Text
a SQL statement to be executed.
Params
Array of parameter values arranged in the same order as they appear in SQL statement.
Return Value
Out parameter with the name Result will hold the result of function having data type dtString. Otherwise returns Null.

Remarks

Use the ExecSQL method to execute any SQL statement outside the TCustomDADataSet or TCustomDASQL components. Supply the Params array with the values of parameters arranged in the same order as they appear in a SQL statement which itself is passed to the Text string parameter.

The Params array must contain all IN and OUT parameters defined in SQL statement. For OUT parameters provide any values of valid types so that they are explicitly defined before call to an ExecSQL method.

Out parameter with the name Result will hold the result of function having data type dtString. If none of the parameters in the Text statement is named Result, ExecSQL will return Null.

To get the values of OUT parameters use the ParamByName function.

Example

OraSession.ExecSQL('begin :A:= :B + :C; end;', [0, 5, 3]);
A:= OraSession.ParamByName('A').AsInteger; 

See Also

© 1997-2024 Devart. All Rights Reserved. Request Support DAC Forum Provide Feedback